package com.boot.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.boot.models.User;
import com.boot.service.UserService;

@RestController
@EnableAutoConfiguration
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping(value="/user/findByName")
    @ResponseBody
    public User  findByName(String name){
	User user=userService.findByName(name);
	System.out.println(user);
	return user;
    }
    
    @RequestMapping(value="/user/insertUser")
    @ResponseBody
    public int  insertUser(String name,String password){
	
	int i=userService.insert(name, password);
	System.out.println(i);
	return i;
    }
}
